package com.tiger.converter;

import java.time.LocalDate;

import javax.persistence.AttributeConverter;
import javax.persistence.Converter;

@Converter
public class LocalDateConverter implements AttributeConverter<LocalDate, String> {
	@Override
	public String convertToDatabaseColumn(LocalDate entityValue) {
		return entityValue != null ? entityValue.toString() : null;
	}
	
	@Override
	public LocalDate convertToEntityAttribute(String databaseValue) {
		return databaseValue != null ? LocalDate.parse(databaseValue) : null;
	}
}
